package com.dubbo.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.dubbo.service.HelloService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {

    //声明业务层
    @Reference(loadbalance = "random")
    //此注解通过dubbo服务去寻找借口的实现,不光是在本项目中  通过动态代理获取代理对象
    //属性:loadbalance:负载均衡
    private HelloService helloService;

    @RequestMapping("hello")
    @ResponseBody
    public String method(String name){
        String s = helloService.helloService(name);
        return s;
    }
}
